package com.mycompany.app.common.webservice.mock;

import java.text.DecimalFormat;
import java.text.NumberFormat;

import javax.jws.WebService;

@WebService(serviceName = "IBankingService", endpointInterface = "com.mycompany.app.common.webservice.mock.IBankingService")
public class BankingServiceWS implements IBankingService {

    //Default constructor.    
    public BankingServiceWS() {

    }
    /** Transfers fund from one account to another.   
     */
    public String transferFunds(String fromAccount, String toAccount,
            double amount, String currency) {

        String statusMessage = "";

        //调用业务逻辑执行操作.    
        //建立并返回状态信息.    
        try {
            NumberFormat formatter = new DecimalFormat("###,###,###,###.00");
            statusMessage = "COMPLETED: " + currency + " "
                    + formatter.format(amount)
                    + " was successfully transferred from A/C# " + fromAccount
                    + " to A/C# " + toAccount;
        } catch (Exception e) {
            statusMessage = "BankingService.transferFunds(): EXCEPTION: "
                    + e.toString();
        }
        return statusMessage;
    }

}
